package com.xhh.greynewsapp.utils;

import com.xhh.greynewsapp.R;

import okhttp3.OkHttp;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;

/**
 * @description
 * @author: weiXhh
 * @create: 2020-05-25 20:05
 **/
public class HttpUtils {

    public static void get(String url, okhttp3.Callback callback){
        OkHttpClient okHttpClient = new OkHttpClient();
        Request request = new Request.Builder().get().url(url).build();
        okHttpClient.newCall(request).enqueue(callback);
    }

    public static void post(String url, RequestBody requestBody, okhttp3.Callback callback){
        OkHttpClient okHttpClient = new OkHttpClient();
        Request request = new Request.Builder().post(requestBody).url(url).build();
        okHttpClient.newCall(request).enqueue(callback);
    }
}
